git mv and git rm commands
to rename and remove files.
These commands are actually shortcuts for using the
git add command.
You can achieve the same results by manually renaming or deleting files and then
updating the Index with git add.
Renaming a file:
First, rename the file in the Working Directory, then usegit add <filename>
to add the renamed file to the Index.
For example, if you have a file named my-file in your Working Directory,
you can rename it to something like file-1. Then, use the
git add file-1 command to add the renamed file to the Index. This
updates the file name in both the Working Directory and the Index.
Removing a file:
First, delete the file in the Working Directory, then usegit add <filename>
to update the Index.
For example, if you have a file named my-file in your Working Directory,
you can delete it from there. Then, if you run the git add my-file command,
Git will notice that the file no longer exists in the Working Directory. As a
result, it will remove the file from the Index as well.